#!/bin/bash

# ES的配置中加入 repositories.url.allowed_urls: ["ftp://172.19.0.1:8022/*"]

# curl ftp://172.19.0.1:8022/a/a.txt --user anonymous:anonymous  -v
#URLs using the ftp, http, https, or jar protocols do not need to be registered in the path.repo setting.
curl -XPUT http://localhost:9200/_snapshot/ftp?pretty -H 'Content-Type: application/json' -d'
{
  "type": "url",
  "settings": {
    "url": "ftp://anonymous:anonymous@172.19.0.1:8022/"
  }    
}
'
:<<EOF
https://discuss.elastic.co/t/security-policy-accesscontrolexception/96116
https://discuss.elastic.co/t/access-denied-for-restore-url-type/72166

出现的问题 TODO
        "type" : "access_control_exception",
        "reason" : "access denied (\"java.net.SocketPermission\" \"localhost:0\" \"listen,resolve\")"
EOF

:<<EOF
curl -XPUT "http://localhost:9200/_snapshot/ftp/ftp_20201204?pretty&wait_for_completion=true" -H 'Content-Type: application/json' -d'
{
}
'
EOF
